# This dockerfile is specific to building Multus for OpenShift
FROM openshift/golang-builder@sha256:4820580c3368f320581eb9e32cf97aeec179a86c5749753a14ed76410a293d83 AS rhel8
ENV __doozer=update BUILD_RELEASE=202202160023.p0.gd27ed81.assembly.stream BUILD_VERSION=v4.10.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=10 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.10.0-202202160023.p0.gd27ed81.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=d27ed81 OS_GIT_VERSION=4.10.0-202202160023.p0.gd27ed81.assembly.stream-d27ed81 SOURCE_DATE_EPOCH=1637609132 SOURCE_GIT_COMMIT=d27ed81cf52f5f2c3837f536bdf0f487f7abc961 SOURCE_GIT_TAG=d27ed81c SOURCE_GIT_URL=https://github.com/openshift/multus-cni 
ADD . /usr/src/multus-cni
WORKDIR /usr/src/multus-cni
ENV CGO_ENABLED=1
ENV GO111MODULE=off
ENV VERSION=rhel8 COMMIT=unset
RUN ./hack/build-go.sh && \
       cd /usr/src/multus-cni/bin
WORKDIR /

FROM openshift/golang-builder@sha256:4820580c3368f320581eb9e32cf97aeec179a86c5749753a14ed76410a293d83 AS rhel7
ENV __doozer=update BUILD_RELEASE=202202160023.p0.gd27ed81.assembly.stream BUILD_VERSION=v4.10.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=10 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.10.0-202202160023.p0.gd27ed81.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=d27ed81 OS_GIT_VERSION=4.10.0-202202160023.p0.gd27ed81.assembly.stream-d27ed81 SOURCE_DATE_EPOCH=1637609132 SOURCE_GIT_COMMIT=d27ed81cf52f5f2c3837f536bdf0f487f7abc961 SOURCE_GIT_TAG=d27ed81c SOURCE_GIT_URL=https://github.com/openshift/multus-cni 
ADD . /usr/src/multus-cni
WORKDIR /usr/src/multus-cni
ENV CGO_ENABLED=1
ENV GO111MODULE=off
RUN ./hack/build-go.sh && \
       cd /usr/src/multus-cni/bin

WORKDIR /usr/src/multus-cni
ENV GO111MODULE=off
RUN ./hack/build-go.sh && \
       cd /usr/src/multus-cni/bin 
RUN ls -lathr /usr/src/multus-cni/bin/multus
WORKDIR /

FROM openshift/ose-base:v4.10.0.20220216.010142
ENV __doozer=update BUILD_RELEASE=202202160023.p0.gd27ed81.assembly.stream BUILD_VERSION=v4.10.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=10 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.10.0-202202160023.p0.gd27ed81.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=d27ed81 OS_GIT_VERSION=4.10.0-202202160023.p0.gd27ed81.assembly.stream-d27ed81 SOURCE_DATE_EPOCH=1637609132 SOURCE_GIT_COMMIT=d27ed81cf52f5f2c3837f536bdf0f487f7abc961 SOURCE_GIT_TAG=d27ed81c SOURCE_GIT_URL=https://github.com/openshift/multus-cni 
RUN mkdir -p /usr/src/multus-cni/images && \
       mkdir -p /usr/src/multus-cni/bin && \
       mkdir -p /usr/src/multus-cni/rhel7/bin && \
       mkdir -p /usr/src/multus-cni/rhel8/bin
COPY --from=rhel7 /usr/src/multus-cni/bin/multus /usr/src/multus-cni/rhel7/bin
COPY --from=rhel8 /usr/src/multus-cni/bin/multus /usr/src/multus-cni/bin
COPY --from=rhel8 /usr/src/multus-cni/bin/multus /usr/src/multus-cni/rhel8/bin
ADD ./images/entrypoint.sh /


ENTRYPOINT ["/entrypoint.sh"]

LABEL \
        io.k8s.display-name="Multus CNI" \
        io.k8s.description="This is a component of OpenShift Container Platform and provides a meta CNI plugin." \
        io.openshift.tags="openshift" \
        maintainer="Doug Smith <dosmith@redhat.com>" \
        vendor="Red Hat" \
        name="openshift/ose-multus-cni" \
        com.redhat.component="multus-cni-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Networking" \
        io.openshift.maintainer.subcomponent="multus" \
        release="202202160023.p0.gd27ed81.assembly.stream" \
        io.openshift.build.commit.id="d27ed81cf52f5f2c3837f536bdf0f487f7abc961" \
        io.openshift.build.source-location="https://github.com/openshift/multus-cni" \
        io.openshift.build.commit.url="https://github.com/openshift/multus-cni/commit/d27ed81cf52f5f2c3837f536bdf0f487f7abc961" \
        version="v4.10.0"

